home *** CD-ROM | disk | FTP | other *** search
- From: talcott!seismo!gatech!unmvax!wampler (Bruce Wampler)
- Subject: tvx: 2 of 10
- Newsgroups: mod.sources
- Approved: jpn@panda.UUCP
-
- Mod.sources: Volume 4, Issue 16
- Submitted by: talcott!seismo!gatech!unmvax!wampler (Bruce Wampler)
-
- #--------CUT---------CUT---------CUT---------CUT--------#
- #########################################################
- # TVX: part 2 of 10
- # #
- # This is a shell archive file. To extract files: #
- # #
- # 1) Make a directory (like tvx) for the files. #
- # 2) Write a file, such as "filen.shar", containing #
- # this archive file into the directory. #
- # 3) Type "sh file.shar". Do not use csh. #
- # #
- #########################################################
- #
- #
- echo Extracting README:
- sed 's/^X//' >README <<\SHAR_EOF
- X TVX - A full screen editor in C
- X
- X===========================================================================
- X**************************** RELEASE NOTES ********************************
- X
- XVersion 3/6/86
- X
- X * This is the second major release of TVX, distributed
- X on mod.sources. All files needed to build TVX for other
- X systems are included on this distribution, also.
- X
- X * The last section of the manual contains instructions for
- X porting TVX to other environments.
- X
- X===========================================================================
- X
- X Developed by:
- X Dr. Bruce E. Wampler
- X University of New Mexico
- X Department of Computer Science
- X Farris Engineering Center
- X Albuquerque, NM 87131
- X ..{ucbvax | seismo!gatech | ihnp4!lanl}!unmvax!wampler
- X
- X
- X This version of TVX Copyright (c) 1986 by Bruce E. Wampler
- X
- X Permission is hereby granted for free, unrestricted nonprofit
- X use of this software. Please feel free to modify, distribute,
- X and share this software as long as you aren't making any money
- X from it. If you want to use this code in a profit making environment,
- X please contact the author for permission.
- X
- XUnix RELEASE NOTES:
- X
- X********* Description of files included in distribution: *********
- X
- X README - this file
- X
- X tvx_ref1.doc - documentation, ready for 80 col, 10 cpi, 66 line printer
- X tvx_ref2.doc - 2nd part, use cat to combine 1 and 2
- X tvx_tut.doc - short beginner's tutorial
- X
- X tvx.ref - text quick reference charts for TVX
- X vix.ref - quick reference chart for vi emulator
- X emax.ref - quick reference chart for emacs emulator
- X
- X
- X Makefile.BSD - Makefile for BSD unix build
- X Makefile.SYSV - Makefile for System V unix build
- X
- X tvx_1.c - main part of code (part 1), mostly os/terminal independent
- X tvx_2.c - main part of code (part 2), mostly os/terminal independent
- X tvx_lex.c - defaults, some os dependent stuff in here. Major
- X changes in defaults can be fixed by recompiling this file.
- X tvx_io.c - almost all I/O, including screen, confined to this file.
- X tvx_lib.c - misc library routines needed by TVX.
- X tvx_unix.c - contains unix specific code, including termcap driver
- X
- X tvx_defs.ic - #define's for version, os, terminal, defaults
- X tvx_glbl.ic - global data structures
- X tvx_term.ic - definitions for various terminals and systems
- X
- X
- X tvx_cfg.c - used to build CONFIG.TVX file for -c switch
- X tvx_ptch.c - used to apply CONFIG to TVX.EXE permanently
- X
- X----- Misc. files for other systems ------
- X
- X tvx_make.bat - batch file to compile IBM-PC tvx with cii c-86
- X tvx_ibm.c - IBM-PC screen driver
- X
- X atari.info - misc files needed to build TVX on an Atari ST
- X
- X===========================================================================
- SHAR_EOF
- echo Extracting tvx.ref:
- sed 's/^X//' >tvx.ref <<\SHAR_EOF
- X *** TVX Quick Reference Summary ***
- X
- X Usage: tvx filename [-b -i -l -o=f -r -s -t -w -# {-z -c=f}]
- X
- X -[no]b : backup file -[no]i : autoindent
- X -[no]l : make command log file -t : tty mode
- X -o=outputfile -r : read only
- X -s : big save buff -[no]w : word processing mode
- X -# : set virtual window lines to #
- X On MS-DOS versions:
- X -[no]z : use control-z for end of file
- X -c=configfile -c : use /bin/config.tvx
- X
- X TVX Commands (n => count allowed)
- X
- X nA Append lines to save buffer (previous contents retained)
- X B Buffer beginning - move cursor to top of current buffer
- X ^B File beginning - move cursor to beginning of file
- X nC Change chars - delete n characters, enter insert mode
- X nD Down line - move cursor to beginning of next nth line
- X n^D Down column - move to same column in nth line down.
- X E Buffer end - move cursor to end of current buffer
- X n^E Insert repeat buffer n into current text for Editing
- X nF Find pattern - terminated with Escape - wild cards possible
- X ^F Find across buffs - searches across file buffers
- X G Get save buffer - insert contents of save buffer into text
- X ^G Unkill last line - get back the last single line killed
- X nH Half page - move cursor down (+n) or up (-n) half screen
- X nI Insert (till $) - If n supplied, then single char inserted
- X J Jump back to line cursor was on before previous command
- X nK Kill character - deletes starting at char cursor is over
- X n^K Kill line - deletes n lines
- X nL Left - move cursor n characters left
- X M Memory status - show basic status
- X nN Note current location, up to 9 different places remembered
- X n^N Reset location - return cursor to location n
- X nO Open blank line - new line in front of cursor
- X ^O Operating system - allows operating system commands
- X nP Page - move cursor up (-n) or down (+n) screenfuls
- X ^P Print screen - only on PCs
- X nR Right - move cursor right n characters
- X ^R Restore edited buffer - Used with ^E command
- X nS Save n consecutive lines in save buffer - deletes old contents
- X nT Tidy (fill text) - uses margin set by :w
- X ^T Abort session - edits are lost!
- X nU Up - move cursor up n lines to line beginning
- X n^U Up column - retains column
- X V Verify - repaints the screen
- X n^W Write buff, get next part of large file, -n writes to cursor
- X ^X Exit, end session - save edits
- X n^Y Yank to(-n)/from(+n) file - prompt for filename will follow
- X nBS Delete character before the cursor
- X n; Find again - re-uses last find pattern
- X / Delete "last thing" - following g, s, a, f, ^f commands
- X = Change "last thing" - like /, but enters insert mode
- X ' Delete to line beginning - deletes before cursor
- X " Delete to line end - cursor onward to end of line
- X , Line beginning - move cursor to beginning of line
- X . Line end - move to end of current line
- X nTAB Word right - move to begining of word to right
- X n{ Word left - left a word. n=0 move to beg of current word.
- X n<>$$ Repeat loop - execute commands between <>'s n times
- X n& Repeat again - execute current repeat buffer again
- X n#k Execute repeat buffer k n times
- X ? Help - gives a help screen
- X @ Invoke cmd file - execute file of TVX commands
- X * Insert pattern found last - leaves in command mode
- X n~ Toggle case - upper to lower, lower to upper
- X $ Escape - end insert, find, repeat
- X n:p Set parameter p - Possible parameters:
- X A - Autoindent (1=y,0=n) D - display line
- X E - Expand tabs to n spaces F - find case (0=exact,1=any)
- X M - Match wild cards O - set output file name
- X S - scroll window R - repeat buffer to use
- X T - tty mode U - define user wild card set
- X V - virtual window W - autowrap width
- X C - cut mode
- X
- X Wild card matching - when wild card matching (:M) is enabled (default),
- X the following wild cards (control characters) are supported
- X
- X ^A - alphanumeric character (a-z,0-9) ^D - a digit (0-9)
- X ^L - any letter (a-z) ^O - Other - not ^A ^P - Punctuation
- X ^X - any single character ^U - a character from user set (:U to set)
- X Any of the above preceded by ^W matches a "word" of the wild card.
- X A ^N will match a "word" of characters NOT in the wild card set.
- X
- SHAR_EOF
- echo Extracting vix.ref:
- sed 's/^X//' >vix.ref <<\SHAR_EOF
- X VIX - A vi-like editor based on TVX
- X
- X Vix is an extension to tvx that provides a close emulation
- Xof the Unix editor vi. While the majority of the common commands
- Xare identical, there are some inherent differences in the way tvx
- Xand vi treat text. Most of the commands were implemented directly
- Xusing the TVX equivalent, although some commands were required new
- Xcode. If the vi command could not be implemented, its command letter
- Xwas left unused, and will produce an error message.
- X
- X Vix does not have the underlying ex editor, so none of the
- Xescape to ex commands work. Vix does have the TVX repeat loop,
- Xhowever, and this compensates to a great extent for the need for ex
- Xfeatures. Please consult the TVX manual for examples of using the
- Xrepeat loop. Note that when using the repeat loop with vix, the commands
- Xwill be vix commands and not tvx commands.
- X
- X Another significant difference is that tvx (and thus vix)
- Xtreats the end of line character as just another character. Thus
- Xcursor movement commands move over the end of line in a fashion one
- Xwould expect. However, when one moves to the end of the line, the
- Xcursor is placed 'over' the newline (displayed after the last real
- Xcharacter in the line). This makes the '$' command work somewhat
- Xdifferently. This also means that you can include a <return> in a
- Xsearch pattern. Vix and tvx use ESCAPE to end the search pattern
- Xinstead of <return>.
- X
- X Vi uses the ':' command to read and write the file (among
- Xother things). Vix uses the ':' to set operating parameters such
- Xas autoindent, screen size, etc. The 'ZZ' (or 'ZA' to abort without
- Xchanges) command is used by vix to exit.
- X
- X Unlike vi and ex, tvx and vix try to load the entire file
- Xbeing edited into memory (called the buffer by tvx/vix, as opposed
- Xto the yank or save buffer). If the entire file doesn't fit, the
- Xuser must manually 'page' the file in and out of memory manually.
- XMost of the 'q' ("tvx" prefix) commands are supplied to handle buffer
- Xmanipulation. For more details, consult the TVX manual. TVX/vix
- Xalso uses the concept of the "last thing" as a major editing tool.
- XWhenever you find a pattern, skip over a word with b or w, save text
- Xinto the save buffer with the 'y' or 'Y' commands, or put text from
- Xthe save buffer, that text is considered the "last thing". The 'c/'
- Xand 'd/' commands will delete the last thing. Entering a new command
- Xwill forget what the last thing was until you again enter a "last
- Xthing" command.
- X
- X The available vix commands are summarized below. The first
- Xcolumn of each entry has a character noting similarities and
- Xdifferences with the real vi commands in the following fashion:
- X
- X- means present in vi, not implemented in vix.
- X= means commands work identically {with possible minor variations}
- X+ means new or significantly different command
- X* means "equivalent" command, somewhat different than vi
- X<space> means command unused in both vi and vix.
- X
- X n in front of command means command takes count argument
- X [synonyms indicated in brackets]
- X
- X ^@: Unused
- X ^A: Unused
- X= n^B: Backward window. {2 lines of continuity not preserved}
- X ^C: Unused
- X= n^D: Down half window.
- X- ^E: Not implemented
- X= n^F: Forward window.
- X* ^G: memory status, short info line
- X= n^H: backspace Command mode: left; Insert mode: del last char
- X= ^I: inserts tab in insert mode, not a command.
- X= n^J: down arrow in column [j,^N]
- X+ n^K: up in column [k,^P]
- X= ^L: verify screen [^R,z]
- X= n^M: down to beginning of line [+]
- X= n^N: [j, ^J]
- X ^O: Unused
- X= n^P: [k, ^K]
- X= ^Q: Unused (flow control)
- X= ^R: Redraw screen [^L,z]
- X= ^S: Unused (flow control)
- X+ ^T: TVX prefix command - see q [q,Q,T]
- X* n^U: Up half window. ** in insert mode, does NOT erase line **
- X* ^V: Not a command. NOT literal quote in insert mode.
- X* ^W: Not a command. NOT used for delete word in insert.
- X ^X: Unused
- X- ^Y: Not implemented
- X- ^Z: Not implemented
- X= Escape: forces command mode, safe follow char for d,c,q.
- X ^\: Unused
- X- ^]: Not implemented
- X- ^^: Not implemented
- X ^_: Unused
- X= <space>: [r]
- X+ n!: Tidy. Fills n lines up to wrap margin. [see autowrap]
- X- ": Not implemented
- X+ n#p: execute repeat loop number 'p' 'n' times
- X= $: goto end of current line {end is newline, not last char}
- X- %: Not implemented
- X- &: Not implemented
- X- ': Not implemented
- X- (: Not implemented
- X- ): Not implemented
- X+ *: insert last matched pattern into text buffer
- X= n+: [CR, ^M]
- X- ,: Not implemented
- X* -: Used in vix for negative counts, use K for up line.
- X- .: Not implemented, repeat loops are a substitute
- X= /: search {Escape used to end pattern, multi-line patterns ok}
- X* 0: 0 is used for counts (especially for : parameters)
- X= 0-9: count value for numeric arguments {may be negative!}
- X- :: Not implemented - use ZZ and ZA to exit
- X- ;: Not implemented
- X+ n<: Begin repeat loop. Loop terminated with >$$. ($ = Esc)
- X+ =: Help screens
- X+ >: Used to terminate repeat loops.
- X= ?: Reverse search {search begins on previous line}
- X+ n@: execute current repeat loop n times (shorthand for n#p)
- X= A: append to end of line
- X* nB: back a word {vix's concept of words is different than vi}
- X= C: changes rest of line
- X= D: delete rest of the line
- X- E: Not implemented
- X- F: Not implemented
- X= nG: goes to line number n, or end of buffer if no n supplied
- X* H: Beginning of buffer (first line in buffer)
- X= I: inserts at beginning of line
- X= J: join lines {not needed since vix treats newlines as chars}
- X+ nK: Up a line to beginning of line
- X* L: bottom line of file
- X+ nM: return to marked location n (n from 1 to 9, see m)
- X= N: like n, but in reverse direction
- X= nO: open a line above current line. n opens n blank lines.
- X= P: put save buffer above current line {save buffers not named}
- X+ T: tvx commands (see q) [^T,q,Q]
- X* U: very limited undo!! It only restores the LAST line killed!
- X V: Unused
- X* nW: Moves forward n words [w] {vix's concept of words not same}
- X= nX: delete n characters before cursor
- X+ nY: append n lines to save buffer (see y), does not change buffer
- X=+ Zx: exit from vix (ZZ: normal, writes file, ZA: abort, no changes)
- X- [[: Not implemented
- X \: Unused
- X- ]]: Not implemented
- X= ^: beginning of line {1st char of line, NOT 1st non-white char}
- X+ _: invoke indirect command file
- X= a: append text starting after cursor
- X* b: back up a word [see B]
- X= c: change c, <sp>, ^, $, or / (delete, enter insert mode)
- X = c - change line
- X = <sp> - change one character
- X = ^ - to beginning of line
- X = $ - to end of line
- X - w, b, and any others not mentioned not implemented
- X + / - the last thing found, yanked or put
- X= nd: delete d, <sp>, ^, $, or /
- X = d - delete line
- X = <sp> - delete character
- X = ^ - to beginning of line
- X = $ - to end of line
- X - w, b, and any others not mentioned not implemented
- X + / - the last thing found, yanked or put
- X- e: Not implemented
- X- f: Not implemented
- X g: Unused
- X= nh: Move left n characters [BS,^H] {will move over lines, too}
- X= ni: insert (if value n supplied, then that ascii code inserted)
- X= nj: down lines, in column [^J,^N]
- X= nk: Up lines, in column [^K,^P]
- X= nl: right n characters [<space>] {moves over lines, too}
- X* nm: mark cur. line as location n. Use M to return to location.
- X= n: find next (in same direction as last ? or /)
- X= no: open n following lines
- X= p: put save buffer after cur line
- X+ q: Prefix character for "tvx" extended commands
- X !: call operating system
- X b: goto real beginning of the file
- X e: edit repeat buffer
- X j: jump back to last location
- X p: put external file from save buffer
- X r: restore repeat buffer
- X s: print screen
- X w: read in next page of file
- X y: yank external file to save buffer
- X /: cross buffer search
- X n:p: set parameter 'p' to value 'n', parameters are:
- X a: autoindent (1 means on, 0 off for all "switch" pars)
- X c: "cut" mode (means 'dd' saves line in yank buffer, too)
- X e: expand tabs to n spaces (8 default)
- X d: home display line (where cursor homes after verify)
- X f: find case mode (0 is case insensitive, 1 exact match)
- X m: match wildcards (1 use ^A, ^L, etc., 0 no wild cards)
- X o: requests new name for output file
- X s: scroll window, cursor moves s lines before scrolling
- X t: tty mode - 1: tty mode, 0: visual mode
- X u: requests entry of user wild card set
- X v: virtual window size
- X w: autowrap limit.
- X= r: replace next char with next character entered
- X= ns: substitute: delete n characters, enter insert mode
- X- t: Not implemented
- X- u: Not implemented (see U)
- X v: Unused
- X* nw: advance word (see W)
- X= nx: delete n characters
- X* ny: yank text to save buffer - will save n lines into save buffer
- X (Only one save buffer, 1st y clears buffer, rest add until
- X non y command entered. dd works in a similar fashion, but
- X kills as it saves (if cut_mode enabled)).
- X= z: refresh screen (^L,^R)
- X- {: Not implemented
- X- |: Not implemented
- X= n~: Change case of next n characters
- X* nDEL: Same as X, delete previous character
- X
- SHAR_EOF
- echo Extracting emax.ref:
- sed 's/^X//' >emax.ref <<\SHAR_EOF
- X EMAX - TVX emulating emacs
- X
- X Important differences: No windows, no marked region, no Q registers,
- Xno word delete/case change, ^K interacts differently with save buffer
- Xmultiple keyboard macros (called repeat loops), much different file
- Xand buffer manipulation.
- X
- X Partial line ^K's (no argument or 0 argument) will save the deleted
- Xtext in the unkill buffer (^CU), but NOT the save/cut buffer. If an
- Xargument is supplied, then the killed lines are save in the save buffer.
- X
- X TVX'x kill last thing concept is implemented as ^C^K.
- X
- X Values can be supplied in two ways. Any of the <esc> commands
- Xmay supply a count after the <esc>. Thus, '<esc>10B' will back over
- X10 words. <esc> may also be used to specify the count for ctrl
- Xcommands: '<esc>10^N' goes down 10 lines. The usual emacs '^U'
- Xalso works to supply arguments. It works in the emacs multiples
- Xof 4, but the Arg: count echoes differently. When you press ^U,
- Xthen the message 'Arg: 4' will appear on the bottom. If you press
- X^U again, it will change to 'Arg: 16'. However, if you enter
- Xany other numeric value, the 'Arg' message disappears, and you
- Xget no additional prompting of values.
- X
- X
- X <ctrl-A> Move to start of line.
- Xn<ctrl-B> (Back) Move backward by characters.
- Xn<ctrl-C> (Command) TVX Command: execute extended commands provided
- X by TVX base. (Warning: these ^C commands have NO relation
- X to ^C commands provided by large emacs implemetations!)
- X ^A Append line to save buffer
- X ^B Move to absolute beginning of file
- X ^E Edit repeat buffer
- X ^F Fill n lines to autowrap margin
- X ^G No op - exit ^C
- X ^H Half screen down
- X ^J Jump back to previous location
- X ^K Delete last thing
- X ^N Move to beginning of next line
- X ^M Mark location n
- X ^P Move to beginning of previous line
- X ^R Restore edited repeat buffer
- X ^W Write buffer, read next portion of file
- X ; Search forward again
- X ~ Change case of next n characters
- X G Goto line number n
- X H Half page up
- X I Insert ascii char n if n supplied,
- X otherwise enter insert mode
- X L Print screen on printer (micros only)
- X M Return to marked location
- X P Put line into save buffer
- X S Search forward across file buffers
- X U Unkill last single line killed
- X Vp Set variable p (like TVX's : command)
- X W Write save buffer to external file
- X Y Yank external file into save buffer
- Xn<ctrl-D> (Delete) Delete next character.
- X <ctrl-E> (End) Move to end of line.
- Xn<ctrl-F> (Forward) Move forward by characters.
- Xn<ctrl-H> Backspace - delete n previous characters
- Xn<ctrl-K> (Kill) With no argument, kill from current position
- X to end of line; if at the end, kill the newline.
- X With argument 0, kill from beginning of line to current
- X position. Otherwise, kill argument lines forward
- X (if positive) or backward (if negative).
- X <ctrl-L> Redraw the screen.
- Xn<ctrl-N> (Next) Move to next line.
- Xn<ctrl-O> (Open) Open line abover cursor.
- Xn<ctrl-P> (Previous) Move to previous line.
- X <ctrl-R> (Reverse) search backward.
- X <ctrl-S> (Search) search forward. { <Esc>S is a synomymn }
- X <ctrl-T> (Transpose) Transpose characters.
- X <ctrl-U> Specify an argument, as described above.
- Xn<ctrl-V> Move forward by n pages.
- X
- X <ctrl-X><ctrl-C> Prompt, and exit unconditionally if 'Y' given.
- X <ctrl-X><ctrl-B> Short buffer status line
- Xn<ctrl-X>E (Execute) Execute current repeat loop n times.
- X
- X <ctrl-Y> (Yank) Yank save buffer to current location.
- X <ctrl-Z> Save current buffer to associated file and exit.
- Xn<Del> Delete the previous n characters. (^H is synonymn)
- X
- X <esc>% Invoke command file (TVX @ file)
- X <esc>! Call operating system
- Xn<esc>#p Execute repeat loop 'p' 'n' times.
- Xn<esc>( Begin a repeat definition. ')<esc><esc>' ends loop.
- X <esc>-,0-9 Auto arugument for other <esc> and CTRL commands.
- X <esc>< Move to beginning of buffer.
- X <esc>> Move to end of buffer.
- X <esc>? Help and status screens
- Xn<esc>B (Back) Move backward by words.
- Xn<esc>F (Forward) Move forward by words.
- Xn<esc>V Move backward by pages.
- X
- SHAR_EOF
- echo Extracting tvx_tut.doc:
- sed 's/^X//' >tvx_tut.doc <<\SHAR_EOF
- X
- X
- X ****************************************************************
- X * *
- X * TVX Interactive Introductions *
- X * *
- X ****************************************************************
- X
- X **** 1 ****
- X
- X This is a demonstration of the capabilities of TVX. Commands to TVX
- Xconsist of single key mnemonic commands. TVX is what is known as a two mode
- Xeditor - command mode and insert mode. TVX is normally in command mode, and
- Xkeystrokes are interpreted as commands like 'up', 'down', 'find', etc. When
- Xyou enter an 'i' for insert, TVX enters insert mode which allows you to enter
- Xtext into the file. For this lesson, you will be requested to enter commands.
- XEach command key you are to enter will be enclosed in 'single quotes'. Thus, a
- Xrequest to enter 'd' means that you should simply hit the 'd' key on the
- Xkeyboard. Each time you hit the 'd' key, the blinking cursor will move down
- Xone line. NOW, hit the 'd' key repeatedly until '**** 2 ****' and part 2 of
- Xthis demo shows on the screen. (You will have to hit the 'd' key around 20
- Xtimes.) Do that NOW.
- X
- X
- X
- X
- X
- X
- X **** 2 ****
- X Welcome to part two of the lesson. Continue to hit the 'd' key until the
- X'**** 2 ****' is at the very top of the screen.
- X TVX was written by Dr. Bruce Wampler, and has been released to the public
- Xdomain. It has versions running on CP/M-80, the IBM-PC, generic MS-DOS, the
- XAtari 520ST, and several versions of Unix. If you read the instructions and
- Xenter the commands when requested, you should get a good demonstration of the
- Xpower of TVX. This lesson is organized into several sections. Each section
- Xwill start with a line in the form '**** 1 ****'.
- X Most of the commands to TVX have been chosen to be mnemonic - thus it is
- X'd' for down, 'u' for up, 'l' for left, and 'r' for right. Pressing any of
- Xthose four keys now will allow you to move the cursor around the screen. The
- X'd' and 'u' commands will move the cursor to the beginning of the next or
- Xprevious lines.
- X
- XNOW, hit the four cursor movement keys needed and position the blinking cursor
- Xat the beginning of this line. Whenever we get to a new section, use the 'd'
- Xcommand to get the '**** n ****' at the top of the screen.
- X TVX is easy to use. Already, you can move around the file and see what is
- Xgoing on. This demo file is actually a text file, just like one you might edit
- Xusing TVX. There are other commands to move the cursor around. The 'p' (page)
- Xcommand moves down 25 lines at a time, which is a new screenful. Right now,
- Xthe cursor should still the line indicated above. If you NOW hit 'p', part 3
- Xwill show up.
- X
- X.... end of part 2 ....
- X
- X
- X
- X
- X
- X **** 3 ****
- X Welcome to section 3. As before, repeatedly hit the 'p' key to position
- Xthe **** 3 **** at the top of the screen.
- X We will now be entering some other TVX commands. When you are requested
- Xto enter a command, the entire sequence will be enclosed in double quotes:
- X"cmds". Remember that commands are mnemonic - one key will enter one command
- Xto the editor. Sometimes entering a command will cause the screen to be
- Xupdated, or a message to be printed at the bottom. Usually, that is normal. A
- Xmajor benefit of a screen editor is "what you see is what you get".
- X Most of the commands to TVX take optional count arguments. To enter a
- Xcount to a command, you enter the count using the digit keys on the top row of
- Xthe keyboard, followed by the command key. Thus, entering the sequence "10d"
- Xwould cause the cursor to go down 10 lines. Counts may be negative, too. If
- Xyou entered "-1p" (or, equivalently, "-p"), the cursor would move UP one
- Xscreenful of text. This convention for entering counts holds true for all TVX
- Xcommands that take count arguments. You may want to try using 'p' or "10d" or
- Xother count instead of repeatedly hitting the 'd' key alone to move around this
- Xlesson.
- X As you use more and more TVX commands, it will be useful to have the quick
- Xreference chart on hand. Don't enter any other commands before requested.
- XThis lesson is not foolproof, either. If you try to get out of sequence of the
- Xlesson, then you will likely get lost.
- X(*** Important note for users with limited RAM. This entire lesson may not fit
- Xinto memory at once! When you get to the point that no more text will scroll
- Xup from the bottom, you must hit '^W'. Pressing both the 'Ctrl' and the 'w'
- Xkeys at the same time will cause the next part of the lesson to be read in.)
- XNOW, hit 'd' (or a 'p') until **** 4 **** is at the screen top.
- X
- X.... end of part 3 ....
- X
- X
- X
- X
- X
- X **** 4 ****
- X We will now actually edit some text. NOTE: This IS a scratch file, so
- Xdon't worry about changing it. The 'k' (for kill a character) command can be
- Xused to delete a single character at a time. By hitting the 'k' key once, the
- Xcharacter the cursor is positioned on will be deleted. A "5k" would delete the
- Xnext 5 characters. NOW, use the four cursor motion commands to position the
- Xcursor on the following sharp: #. We will delete this text. After the cursor
- Xis on the #, repeatedly hit the 'k' key and delete only the sentence
- Ximmediately following the #.
- X We will continue with simple editing of text. If at any time, the text is
- Xoff the bottom of the screen, use the 'd' down key to move down and scroll the
- Xnew text onto the screen as needed.
- X The backspace key may be used to delete one character at a time before the
- Xcursor. NOW, position the cursor over the '0' in the following string:
- X1234567890abcd. NOW, use the backspace key to delete the digits before the
- X'0'. If you had used 'k' instead, the characters AFTER the '0' would have been
- Xdeleted. That's all there is to deleting text.
- X Suppose you want to delete an entire line. The '^k' key (pressing the
- X'Ctrl' key and the 'k' key at the same time, from now on, '^x' means Control-X)
- Xwill delete the entire line that the cursor is currently positioned on. NOW,
- Xposition the cursor anywhere on the next line.
- X---- We will delete this entire line ----
- XNOW, with the cursor on the previous line, when you hit '^k', it will be
- Xdeleted. Of course, you can use a count argument and delete several lines,
- Xforwards or backwards. Remember that counts are entered using the by entering
- Xa count before the command key. NOW, position the cursor on the next line.
- XWe will now delete 5 lines. NOW, enter the command sequence "5^k".
- XThis is line 2 to be killed.
- XLine 3
- XLine 4
- XLine 5
- X
- X Those 5 lines should now be gone.
- X
- X What if you accidentally kill a line? You can get it back!
- XNOW, position the cursor on this line and hit '^k'.
- XIt's gone. NOW, before you enter any other commands, press '^g' (for get
- Xback). That line is back! This works only for the last killed line, however.
- XIf you had entered "5^k", then only the last line would have been recovered.
- XThe last line killed will be saved until another line is killed.
- X Two other useful commands are available for deleting text. You may want
- Xto delete the rest of a given line, or you may want to delete the first part of
- Xthe line. NOW, position the cursor over the c on the next line:
- X1234567890abcdef
- XIf you now hit '"' key (double quote), the part of the line from the 'c'
- Xonwards will be deleted. Now move the cursor back to the '0'on that line. To
- Xdelete the first part of the line, use ''' (single quote). You should now have
- X'0ab' on that line, since the ''' does not include the character the cursor is
- Xon. The '^G' unkill command works for ''' and '"', just like '^k'.
- X NOW, move the cursor down and get part 5 (**** 5 ****) to the top of the
- Xscreen. You can use 'p' or 'd'.
- X
- X.... end of part 4 ....
- X
- X
- X
- X **** 5 ****
- X We will now insert some text. To insert text, you first position the
- Xcursor to the place you want to insert the text. Then enter the 'i' (for
- Xinsert) to enter insert mode, then enter the text you want to insert using the
- Xregular keyboard keys. Notice that the message '### Insert Mode ###' appears
- Xon the bottom of the screen. On some versions, the shape of the cursor will
- Xchange, too. As you type, the text you enter will appear on the screen in
- Xfront of the cursor: "what you see is what you get". As you continue, all
- Xcharacters that you type will continue to be inserted. When you are done
- Xinserting text, press the 'Esc' key. You will now be back in command mode.
- X NOW, let's try to insert something. How about your name. Position the
- Xcursor over the period (.) on the next line:
- XMy name is: .
- XNOW, press 'i' to enter insert mode, then type your name, and finally press
- X'Esc' to return to command mode. That is all there is to inserting text. TVX
- Xis a line oriented editor, which is most useful for entering programs. You
- Xpress the 'Return' key to end a line and begin a new one.
- X Sometimes you may want to insert a block of text in the middle of a line,
- Xor before some existing text. You can simply enter the text, but the constant
- Xshifting of text to the right can be visually unpleasant. The 'o' (open)
- Xcommand will open a new line for inserting text. Try it.
- X The next section covers the find pattern command will show you how to
- Xsearch for text and find the section or line of the file you want to edit.
- X
- X.... end of part 5 ....
- X
- X
- X
- X
- X **** 6 ****
- X It is often useful to be able to find a particular word or pattern in the
- Xtext file. The TVX find command may be used for this. To start the find
- Xcommand, you first press the 'f' (find) key. This will cause the message
- X"Find?" to be printed on the bottom of the screen. You then enter the pattern
- Xyou want to find. The pattern is terminated with an [Esc]. If the pattern is
- Xfound, the screen will be updated, and the cursor placed after the pattern. If
- Xthe pattern is not found, the cursor is not changed and "Not found" will be
- Xprinted on the bottom. When entering the pattern, you may use the backspace
- Xkey to edit your input. Each time you hit the backspace key, one character is
- Xdeleted.
- X NOW, let's search for the pattern "replace". To do this, first hit the
- X'f' command, followed by "replace[Esc]". The cursor will now be placed after
- Xthe next occurrence of "replace". If you had supplied a count of -1 (or -)
- Xbefore the 'f', then the search would have been for the first previous
- Xoccurrence of "replace".
- X If you now hit the ';' (find again) key, the next occurrence of the last
- Xpattern you found, here "replace", will be found. TVX always remembers the
- Xlast pattern you found, and the ';' command will search again.
- X Speaking of replace, TVX makes it easy to find a pattern and then either
- Xdelete that string or replace it with a new string. If you hit the '/' (delete
- Xlast) key immediately after finding a pattern, that pattern will be deleted.
- XTry another ';' to find 'replace' again, and then hit '/'. If you want to then
- Xreplace the text, you can use the '=' command. It is just like entering "/i".
- X Normally, the find pattern command ignores upper and lower case. You can
- Xsearch for the exact case, however. You may also search for arbitrary
- Xpatterns. See the user's manual for details.
- X
- X
- X.... end of part 6 ....
- X
- X
- X
- X
- X **** 7 ****
- X This section covers more cursor movement commands. So far, we have only
- Xused the four cursor motion keys and the 'p' commands. Two commands let you
- Xskip over a word at a time. These are the 'TAB' and '{' (or '[') commands.
- XThus, the 'TAB' key will skip over the next word to the right. The '{' skips
- Xover words backwards. Try using those two commands to see how they work.
- X The '.' (period, usually the same key as '>') command will move the cursor
- Xto the end of the current line. The ',' (comma, on the same key as '<')
- Xcommand moves the cursor to the beginning of the line. Experiment with those
- Xtwo commands.
- X You may have noticed that the 'u' and 'd' commands always move the cursor
- Xto the beginning of the line. Two commands will move the cursor vertically,
- Xbut keep it in the same column. The '^d' key moves down in the same column,
- Xand the '^u' command moves up in the same column. Try using 'u', 'd', '^u',
- Xand '^d' to see the difference in their operation.
- X The 'p' command moves up and down (with a - count) a screenful. The 'h'
- Xcommand keys will move the cursor a half screenful at a time.
- X You also can get to the very beginning or the very end of the file. These
- Xcommands are 'b' (begin) and 'e' (end). Whenever you enter a command that
- Xmoves the cursor a long ways, TVX remembers where you came from. Immediately
- Xafter entering a command that changes the cursor location, you can use the 'j'
- X(jump back) command to return the cursor to the previous location. For
- Xexample, if you enter 'b' followed by a 'j', you will move to the beginning,
- Xthen jump back to here. The 'j' is most useful after the begin and end
- Xcommands, as well as after a 'f' find command.
- X
- X
- X.... end of part 7 ....
- X
- X
- X
- X
- X
- X
- X **** 8 ****
- X We will now cover some of the more advanced features of TVX, such as
- Xmoving blocks of text and entering editing macros. TVX can be used to easily
- Xmove text around a file. First, lets move a copy of the following three lines
- Xdown a ways. Use 'd' to place the cursor at the beginning of the following
- Xthree lines.
- XSaved line 1 Saved line 2 Saved line 3
- XNOW, hit the 's' (for save) command three times (or "3s"). Note that the
- Xcursor moved down three lines and is now positioned over the NOW. We will make
- Xa copy of those lines below here. Place the cursor over the # on the next
- Xline.
- X# The saved text will get copied above this line
- XIf you now hit the 'g' (get) command, a copy of the three saved lines will get
- Xinserted right before the # line. These commands are called 'Save line' and
- X'Get back saved text'.
- X Remember the '/' delete pattern command used on 'f' find? That command
- Xreally is "delete last thing", where the last "thing" can be a find pattern as
- Xbefore, or the text just saved in the save buffer, or the text just gotten from
- Xthe save buffer. Now we can easily move several lines of text. Save the
- Xfollowing two lines by positioning the cursor at the beginning of the first and
- Xthen hitting 's' twice.
- XMove this line 1 Move this line 2
- XNow the cursor will be at the beginning of this line. If you now hit the '/'
- Xkey, those two lines will be deleted. Move them to the following line by
- Xpositioning the cursor and hitting the 'g' to get them back.
- XMove them to in front of this line.
- X Each time you hit the 's' key, another line is saved in the save buffer.
- XIf you don't enter any other commands between consecutive 's' commands (or 's'
- Xwith counts) continue to add text to the save buffer. The first 's' command
- Xentered following any other command will first clear whatever text might
- Xalready be in the save buffer.
- X If you want to save a few lines from one part of the file, then a few more
- Xfrom a different place, you can use the 'a' append command. Append is very
- Xmuch like the save command except that it always adds on to the end of the save
- Xbuffer and will not clear it if there are other commands between.
- X A few more words about the '/' delete last thing command. So far you have
- Xseen how '/' works with the 'find' and 'save' commands. It also works right
- Xafter a 'g' get command, so if you get text to the wrong place, you simply need
- Xto hit '/' to delete it again. '/' also works right after the 'TAB' and '{'
- Xcommands, which makes it easy to delete words. If you entered "5[TAB]"
- Xfollowed by a '/', the cursor would skip over 5 words and then those 5 words
- Xwould be deleted. You may try that here if you wish to see it work.
- X
- X
- X
- X.... end of part 8 ....
- X
- X
- X
- X **** 9 ****
- X This section demonstrates the use of the repeat buffer. The repeat buffer
- Xallows you to enter one or several commands and cause them to be repeatedly
- Xexecuted. For example, suppose you wanted to change the next 3 occurrences of
- X'abc' to 'wxyz'. Using the 'f' find and '/' delete last (or even '=' delete
- Xlast and insert) commands to do this manually can be time consuming. It would
- Xbe difficult to do this if there were 100 changes to make. The repeat loop
- Xsolves this problem. To do the example one time, you might enter the
- Xfollowing: "fabc[Esc]=wxyz[Esc]". (Note that [Esc] means the Escape key, and
- Xwill be echoed on the bottom of the screen as a '$'.) We will now do this three
- Xtimes. FIRST, position at the beginning of the next line.
- XThe cursor should be at the beginning of this line. Now, enter a '3' followed
- Xby the '<' (begin loop) key. That will cause the message "repeat: 3<" to be
- Xprinted on the bottom line. Now, enter the above command:
- X"fabc[Esc]=wxyz[Esc]". That is the body of the repeat loop. To change the
- Xnext 3 abc's (abc), now terminate the loop by entering ">[Esc][Esc]". The '>'
- X(upper case comma key) closes the loop, and the double [Esc] is necessary to
- Xterminate the loop. Note that the [Esc] echoes as '$'. Now, the next three
- Xoccurrences of abc will have been changed to 'wxyz'. If there had been less
- Xthan three occurrences of 'abc', then the loop would have terminated early with
- Xan error message. You may use the backspace key to edit your input to the
- Xrepeat command, just as with find.
- X Now suppose you want to change the next 'abc' into 'wxyz'. TVX remembers
- Xthe loop you just entered. (Actually, there are 3 to 9 different repeat loops
- Xwhich can be displayed by entering the '?' help command.) Now, to change one
- Xmore 'abc', press the '&' key. The 'Rpt agn' command will cause the loop to be
- Xre-executed count times.
- X These repeats can get quite complex. This can be a danger, but is a
- Xpowerful tool. Any of the 3 to 9 repeat loop buffers can be selected and used
- Xto hold TVX command macros. The Reference Manual explains how to use the
- Xmultiple repeat buffers. By doing nothing, however, you still get the one
- Xdefault repeat loop with no extra worry or action on your part.
- X
- X
- X
- X.... end of part 9 ....
- X
- X
- X
- X
- X
- X **** 10 ****
- X There is one command that you may find useful occasionally (at least on
- Xsingle user systems such as an IBM-PC): screen print. The '^p' command will
- Xcause the current screen to be sent to the printer (if there is one!). By
- Xconsecutively hitting '^p', 'p', ..., you can print as much of your file as you
- Xwish. You can try that now if you have a printer and it is ready.
- X
- X
- X
- X
- X
- X.... end of part 10 ....
- X
- X
- X
- X
- X
- X **** 11 ****
- X TVX has one other major feature that may occasionally be useful to you.
- XYou can read in an external file into the save buffer. The 'g' get command can
- Xthen be used to insert that text into the file you are editing. To use this
- Xcommand, press '^y' (for yank). You will be asked for the name of a file.
- XThat file will be read in. If you now position the cursor and press 'g', the
- Xcontents of that file will be placed in the current buffer.
- X The opposite of '^y' is "-^y". You can save a portion of the current file
- Xin another one. Save the section you want to write in the save buffer using
- Xthe 's' command, then enter "-^y". You will be asked for the name of the file
- Xto write to. The current contents of the save buffer will then be saved in
- Xthat file.
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X **** 12 ****
- X TVX has several features that improve its interaction with nroff type text
- Xformatters. (These formatters typically have formatting commands that begin
- Xwith a period in column one of the line.) One is the auto-wrap feature. With
- Xthe feature, TVX will automatically wrap around when you pass a specified
- Xcolumn when entering text. To turn on auto-wrap, enter the command "70:w".
- XThe 70 means wrapping will occur when you enter the first space after column
- X79. The ':' is a general 'set' command used to set various parameters to TVX.
- X
- XWhen you use auto-wrap, you will get source text with a generally even
- Xappearance. However, as you edit text, you will find the
- Xlines getting uneven, just like this text. The "tidy" command can be
- Xused to even out these lines. Move the cursor
- Xto the beginning of this text, and enter "8t". Each
- X't' will tidy one line. Tidy works very much like a formatter's filling,
- Xand knows about dot commands. It also won't tidy lines beginning
- Xwith a blank or tab.
- X
- X
- X
- X
- X
- X **** last ****
- X TVX has several other features and commands. These are described in
- Xdetail in the TVX reference manual. This lesson has tried to give examples of
- Xsome of the more commonly used features of TVX.
- X Feel free to experiment on this lesson file with all the commands provided
- Xby TVX. The best way to learn about the operation of TVX is by using it. You
- Xare on your own now. When you are done, you can exit TVX with the '^X' exit
- Xcommand. You should have a good idea of the philosophy of TVX now, and can
- Xread the user's manual with new insight.
- X
- X
- XRemember - '^x' to exit, 'b' for beginning, 'e' for end
- X
- SHAR_EOF
- echo ALL DONE!
- exit 0
-
-